<template>
	<div v-loading="loading">
		<bread-crumb divider refresh @actRefresh="getCallBackUrl">
			<template slot="title">卡券回调设置</template>
		</bread-crumb>

		<div>当前回调地址：{{callbackUrlCurrent}}</div>
		<div>
			<el-input v-model="callbackUrlInput" style="width: 500px"></el-input>
			<el-button type="success" @click="actUpdateUrl()">提交</el-button>
		</div>
	</div>
</template>

<script>
import {
	apiGetCallbackUrlOfCouponBusiness, apiSetCallbackUrlOfCouponBusiness,
	apiUserMoneyLog,
} from '@/axios/api.system';
import { mixins } from '@/mixins/mixins.global';
import { mixinUtils } from '@/mixins/mixins.utils';
import breadCrumb from '@/views/components/breadCrumb';
import { isEmpty } from "@/libs/util";
export default {
	name: 'callbackSet',
	mixins:[mixins,mixinUtils],
	components:{breadCrumb},
	data() {
		return {
			callbackUrlInput:"https://www.qzzhuoen.com/WxCouponNotifyServlet/couponNotifyDispatchOfBusiness",//输入的回调地址
			callbackUrlCurrent:"",//当前回调地址
		}
	},
	mounted() {
	},
	created() {
		this.getCallBackUrl()
	},
	methods:{

		//读取
		getCallBackUrl() {
			apiGetCallbackUrlOfCouponBusiness({
			}).then(( res ) => {
				if(res.resultFlag == true){
					this.notify(res.resultMsg,'success')
					this.callbackUrlCurrent = res.data
				}else{
					this.notify(res.resultMsg,'warn')
				}
			})
		},

		//更新
		actUpdateUrl(){
			let url = this.callbackUrlInput
			if(isEmpty(url)){
				this.$message.error("没有输入url")
				return false
			}
			apiSetCallbackUrlOfCouponBusiness({
				url:url
			}).then(( res ) => {
				if(res.resultFlag == true){
					this.notify('',res.resultMsg,'success')
				}else{
					this.notify('',res.resultMsg,'warn')
				}
			})
		},


	}

};
</script>

<style lang="less">

</style>
